<template>
	<view class="selectAccountNumber">
		<!-- 选择户号 -->
		<view class="content">
			<view @click="passMsg(v.roomNumber)" open-type="navigateBack" hover-class="navigator-hover"
				v-for="v in accountNumber" :key="v.id">
				<view class="item">
					{{v.roomNumber}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		http
	} from "../../../../utils/http.js"
	export default {
		data() {
			return {
				accountNumber: [],
				buildingName: "",
				unitName: ""
			};
		},
		methods: {
			getData() {
				http({
					url: "/housingManagement/list",
					method: "get",
					params: {
						buildingName: this.buildingName,
						unitName: this.unitName
					},
				}).then(({
					data
				}) => {
					this.accountNumber = data.list
					console.log(this.accountNumber)
				})
			},
			passMsg(v) {
				uni.navigateTo({
					url: '../addHouse?accountNumber=' + v
				});
			},
		},
		onLoad(option) {
			let buildandunit = JSON.parse(option.buildandunit)
			this.buildingName = buildandunit.buildingName
			this.unitName = buildandunit.unitName
			this.getData()
		}
	}
</script>

<style lang="less">
	.selectAccountNumber {
		.content {
			padding: 0 9rpx;
			padding-top: 76rpx;
			display: flex;
			flex-wrap: wrap;

			.item {
				width: 204rpx;
				height: 100rpx;
				text-align: center;
				margin: 19rpx;
				line-height: 100rpx;
				border-radius: 10rpx;
				border: 1px solid #ccc;
			}
		}
	}
</style>
